nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

react/Custom Hooks

Extracting reusable stateful logic into your own 'use' functions.

10 QuestionsAdvancedHigh Priority ~11 min read

A custom hook is just a plain JavaScript function that calls other hooks internally, following the use- naming convention so both React and lint tooling can correctly apply the Rules of Hooks to it. Custom hooks let you extract and share stateful behavior — form handling, data fetching, subscriptions — across components without the wrapper components that HOCs or render props required.

The nuance that's easy to get wrong: a custom hook shares logic, not state. Every component that calls the same custom hook gets its own completely independent instance of whatever state that hook manages — calling useFetch(url) in two different components does not share data between them, unless the hook is deliberately built to read from something external like context or a module-level store.

What you'll walk away knowing

What actually makes something a custom hook (calling other hooks, following the use- naming convention)
The key nuance: custom hooks share logic, not state — each caller gets its own independent instance
How to design a custom hook's return value (array vs. object) and when each is the better choice
Common custom hook patterns worth knowing: useFetch, useDebounce, useLocalStorage
1Implement useMediaQuery hook.Intermediate2Recap.Intermediate3Implement useDebounce hook.Intermediate4Implement useLocalStorage hook.Intermediate5List potential pitfalls or risks of Custom Hooks.Intermediate6What should we do in cleanup functions?Intermediate7What are the advantages of cleaning up after an effect?Intermediate8What should be returned by custom hooks?Intermediate9What is the useEffect cleanup function?Intermediate10What are the advantages of Custom Hooks?Intermediate11What should not be put into custom hooks?Intermediate12What points to note and take care of while writing custom hooks?Intermediate13When should we use a custom hook?Intermediate14Why do we need custom hooks?Intermediate
All Topics
1
Basics
JSX
State and Props
Components
Function Components
2
Virtual DOM
Reconciliation
Class Components
Lifecycle functions
3
Hooks
useState
useReducer
useMemo
useContext
useCallback
useEffect
Custom Hooks
New Hooks
4
Code Sharing
HOC
Refs
Data Sharing
Events
Context API
5
Redux
Router
CSR-SSR
React APIs
ReactDOM
Strict Mode
6
Performance Optimisation
Security
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.